package org.jground.zk.zulX;

import org.zkoss.zk.ui.Component;
import org.zkoss.zul.Panel;
import org.zkoss.zul.Panelchildren;

public class PanelX extends Panel {

    private Panelchildren children;

    public PanelX() {}

    public PanelX(String title, String border, boolean collapsible, Component... components) {
        setTitle(title);
        setBorder(border);
        setCollapsible(collapsible);
        add(components);
    }

    public PanelX(Component parent, String title) {
        this.setParent(parent);
        setTitle(title);
    }

    public Panelchildren getPanelChildren() {
        if (children == null) {
            children = new Panelchildren();
            children.setParent(this);
        }
        return children;
    }

    public void add(Component... components) {
        for (Component component : components) {
            component.setParent(getPanelChildren());
        }

    }
}
